﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage_Admin.master" AutoEventWireup="true" CodeFile="Index.aspx.cs" Inherits="Main_Index" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="Server">
    <style type="text/css">
        .ui-note {
        }

        .ui-note-item {
            float: left;
            width: 290px;
            height: 250px;
        }

        .ui-note-body {
            margin: 8px;
            height: 220px;
            background: #f7f4aa;
            box-sizing: border-box;
            cursor: text;
            box-shadow: 3px 3px 10px 1px rgba(0, 0, 0, .3);
        }

        .ui-note-header {
            background: #f0ed9e;
            height: 28px;
        }

        .ui-note-tool {
            float: right;
            width: 90px;
            text-align: right;
            padding-right: 10px;
        }

            .ui-note-tool a {
                color: #666;
            }

        .ui-note-icon {
            top: -20px;
            z-index: 6;
            width: 44px;
            height: 44px;
            margin-left: -22px;
            display: inline-block;
            position: relative;
            background: url(/Resources/Images/Index/note1.png);
        }

        .ui-note-time {
            float: left;
            width: 50%;
            text-indent: 10px;
        }

        .ui-note-content {
            padding: 5px;
            height: 182px;
            overflow: auto;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Title" runat="Server">
    首页
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Content" runat="Server">

    <div style="margin-top: 10px;">
        <div class="ht-title">
            <b>我的便签</b>
            <a id="btn_AddNode" href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add'" style="margin-left: 20px;">新增</a>
            <a id="btn_NodeRecovery" href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-sum'" style="margin-left: 20px;">回收站</a>
        </div>
        <div class="ui-note" style="margin-top: 20px;">
            <ul id="node">
                <li class="ui-note-item">
                    <div></div>
                </li>
                <li class="ui-note-item">
                    <div></div>
                </li>
                <li class="ui-note-item">
                    <div></div>
                </li>
            </ul>
            <div class="clearfix"></div>
        </div>
        <div id="pager_node"></div>
    </div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Footer" runat="Server">
    <%--弹出窗--%>
    <div id="Window" class="easyui-window" title="" data-options="modal:true,closed:true,fit:false,collapsible:false" style="width: 400px; height: 400px; overflow: hidden;">
        <iframe src="" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe>
    </div>
    <%--弹出窗--%>
    <div id="Window2" class="easyui-window" title="" data-options="modal:true,closed:true,fit:false,collapsible:false" style="width: 800px; height: 600px; overflow: hidden;">
        <iframe src="" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe>
    </div>

    <!--数据加载-->
    <script type="text/javascript">

        $(function () {
            //加载数据
            refreshNodeData();
        });

        function refreshNodeData() {
            var query = {
                pageSize: 100,
                pageIndex: 1,
                OrderField: '',
                QueryString: '',
                Type: 1
            }

            $.ajax({
                type: 'post',
                datatype: "json",
                contentType: "application/json",
                url: 'Index.aspx/GetNodeDataHtml',
                data: JSON.stringify(query),
                success: function (result) {
                    if (result.d.msg != '') {
                        alert(result.d.msg);
                        return;
                    }
                    $('#node').html(result.d.gridHtml);
                }
            });
        }

        function delGridData(url, id) {

            if (!confirm('确定要把该记录放入回收站吗？'))
                return;

            var param = new Object();
            param.Id = id;

            $.ajax({
                type: "post",
                datatype: "json",
                url: url,
                contentType: "application/json",
                data: JSON.stringify(param),
                success: function (result) {
                    if (result.d != '') {
                        alert(result.d);
                    } else {
                        refreshNodeData();
                    }
                }
            });
        }

        function toFirst(url, id) {

            if (!confirm('确定要把该记录移到第一位吗？'))
                return;

            var param = new Object();
            param.Id = id;

            $.ajax({
                type: "post",
                datatype: "json",
                url: url,
                contentType: "application/json",
                data: JSON.stringify(param),
                success: function (result) {
                    if (result.d != '') {
                        alert(result.d);
                    } else {
                        refreshNodeData();
                    }
                }
            });
        }
    </script>

    <%--弹窗 我的便签，新增--%>
    <script>
        var $win = $('#Window');
        function showWindow(title, url) {
            $win.window({ title: title });
            $win.find('iframe').attr('src', url);
            $win.window('open');
            $('body').css('overflow', 'hidden');
        }
        $(function () {
            $('#btn_AddNode').click(function () {
                showWindow('我的便签<新增>', 'NodeEdit.aspx');
            });
        });

        function closeWindow() {
            $win.window('close');
            $('body').css('overflow', 'auto');
        }

        function closeWindowAndRefresh() {
            closeWindow();
            refreshNodeData();
        }
    </script>

    <%--弹窗 我的便签，回收站--%>
    <script>
        var $win2 = $('#Window2');
        function showWindow2(title, url) {
            $win2.window({ title: title });
            $win2.find('iframe').attr('src', url);
            $win2.window('open');
            $('body').css('overflow', 'hidden');
        }
        $(function () {
            $('#btn_NodeRecovery').click(function () {
                showWindow2('我的便签<回收站>', 'NodeList.aspx');
            });
        });

    </script>

</asp:Content>

